Skip to content

feat(scenarios): a card may name a roll-up a persona is meant to read over withheld rows - #37271

Draft
objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-37257-o2c-allowed-rollup
Draft

objectstack-fleet[bot] wants to merge 3 commits into
mainfrom
claude/issue-37257-o2c-allowed-rollup

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

repo:objectstack#4 · os-justin · session_01QSeKYo86w1wqy2z2fMrryr
Fixes #37257

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户无感:订单到收款场景卡的评分里,销售代表看到自己发票的已收金额、余额和状态不再被扣分;看不到一笔笔收款记录的要求不变。
  • 落实你对「销售代表能否看到发票已收金额」那张决策卡的裁决 B,解开订单到收款那轮重跑和它挡住的评测卡。
  • 只影响评测打分:卡上点名允许、且搭建写明了理由的那一个汇总不扣分,其余汇总照扣;撤回即恢复全部扣分。
  • 无

What changes

  • Card key. A persona may carry allowedRollups (FieldRefSchema[], the card's bare names, optional, absent by default) in packages/qa/scenarios/src/schema.ts. The persona schema refuses an allowed roll-up that the persona's own hidden names.
  • Reader. rollupSourceCharges (packages/qa/scenarios/src/runner/orchestrate.ts) skips a security-rollup-source-unreadable finding that is acknowledged (the rule's info arm, i.e. rollupSourceUnreadableReason on the set) AND whose roll-up the persona's allowedRollups names. The card's names are prefixed with the card namespace before the comparison (invoice.amount_paid reads as demoorder_invoice.amount_paid, the build's name). An unacknowledged finding on the allowed roll-up, and every other roll-up over withheld data, is still charged.
  • Card. docs/qa/scenarios/order_to_cash.json: the prompt sentence (zh and en kept in step) now says the rep sees their invoices' 已收金额 / 余额 / 状态 but not the individual payment rows; the sales-rep persona carries allowedRollups: [{ object: invoice, field: amount_paid }]. hidden is unchanged (payment, product.unit_cost).
  • README § Roll-ups over withheld data: one sentence states the key and the exception.
  • Changeset @objectstack/scenarios patch (the package is published and ships the card library).

Tests

Pin: new top-level describe in packages/qa/scenarios/test/runner/orchestrate.test.ts on the real order_to_cash card, namespaced:

  • acknowledged amount_paid + acknowledged payment_count, card allows amount_paid → only payment_count charged;
  • the same build with the key removed from the card → both charged;
  • neither acknowledged → both charged (the unacknowledged finding on the allowed roll-up stays charged);
  • the schema refuses an allowed roll-up the persona hides.

Ablation (once, after commit): the reader line deleted through scripts/ablation-replace.mjs (anchor 1 → 0, blob 9f7c6d1acc4f → 38300e4a41a0) → Tests 1 failed | 4 passed (the allowed-roll-up case red: demoorder_invoice.amount_paid charged); restored, blob == HEAD 9f7c6d1acc4f, git diff HEAD empty. The test imports src/ directly, so no dist rebuild sits in the path.

Acceptance notes

  • The persona schema refuses an allowed roll-up the persona hides, but the loader's cross-reference checks (object in expect.objects, the seed carries the field) are not applied to allowedRollups: the loader is outside this claim's file surface. A misspelt entry fails closed (never matches, so the finding stays charged).
  • namespacedScenario (runner/namespace.ts, also outside the surface) passes allowedRollups through bare; the reader prefixes idempotently, so it matches either a bare or a namespaced card.
  • The build prompt's persona line (runner/prompts.ts) still lists only what the persona must not read; the intent reaches the builder through the card prompt sentence.

Verification

Two minutes: pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/runner/orchestrate.test.ts -t 'allows a persona' → 5 passed.

Read first: packages/qa/scenarios/src/runner/orchestrate.ts (the one skip in rollupSourceCharges), packages/qa/scenarios/src/schema.ts (allowedRollups + refine), docs/qa/scenarios/order_to_cash.json (prompt sentence).

Local readings at d175093
  • pnpm --filter @objectstack/scenarios build && … test && … typecheck under the verify lock: VERDICT command-exit 0; Test Files 42 passed (42), Tests 1336 passed (1336).
  • node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran …: 69 derived, 68 run (all exit 0), 1 NOT-MEASURED (pnpm check:dual-build-cjs-loads exit 3, PREREQUISITE NOT MET: needs a full build; left to CI), 0 UNRUN.
  • node scripts/pm/overlap-check.mjs --branch=HEAD: VERDICT clean exit 0.

… over withheld rows (order_to_cash: invoice.amount_paid for the sales rep)

Claude-Session: https://claude.ai/code/session_01QSeKYo86w1wqy2z2fMrryr
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md) — pages documenting those are invisible to this run
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 057cedfa9b6f990a7cf322118ae33bc4460ddc65 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 59d9749085954e8cc185021bcbfa987768875f12 — the merge of head d1750933e260d92e20b253413af991e5993b06cb into base 057cedfa9b6f990a7cf322118ae33bc4460ddc65, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 59d9749085954e8cc185021bcbfa987768875f12 && git checkout 59d9749085954e8cc185021bcbfa987768875f12
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 057cedfa9b6f990a7cf322118ae33bc4460ddc65 d1750933e260d92e20b253413af991e5993b06cb && git checkout -B drift-repro 057cedfa9b6f990a7cf322118ae33bc4460ddc65 && git merge --no-ff d1750933e260d92e20b253413af991e5993b06cb

node scripts/docs-audit/affected-docs.mjs --json 057cedfa9b6f990a7cf322118ae33bc4460ddc65

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Decision] order_to_cash: may a sales rep see an invoice's 已收金额 (a roll-up of payments the card hides from reps)?

2 participants